import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    component: () => import('@/views/Login') // 路由懒加载
  },
  {
    path: '/layout',
    component: () => import('@/views/Layout'), // 路由懒加载
    redirect: '/layout/home', // 重定向打开默认显示的界面
    children: [{
      path: 'home',
      component: () => import('@/views/Home')
    },
    {
      path: 'user',
      component: () => import('@/views/User')
    }]
  }

]

const router = new VueRouter({
  routes
})

export default router
